def save_avatar(backend, user, response, *args, **kwargs):
    if backend.name == 'qq':
        avatar_url = response.get('figureurl_qq_2')
    elif backend.name == 'weixin':
        avatar_url = response.get('headimgurl')
    elif backend.name == 'github':
        avatar_url = response.get('avatar_url')

    if avatar_url and not user.avatar:
        user.avatar = avatar_url
        user.save()
